home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 8685 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  2.3 KB

  1. Path: gambier.ugrad.cs.ubc.ca!not-for-mail
  2. From: c2a192@ugrad.cs.ubc.ca (Kazimir Kylheku)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Help with sin() - big problem
  5. Date: 5 Mar 1996 13:19:25 -0800
  6. Organization: Computer Science, University of B.C., Vancouver, B.C., Canada
  7. Message-ID: <4hib4tINN68q@gambier.ugrad.cs.ubc.ca>
  8. References: <4hhusi$49i@sunburst.ccs.yorku.ca>
  9. NNTP-Posting-Host: gambier.ugrad.cs.ubc.ca
  10.  
  11. In article <4hhusi$49i@sunburst.ccs.yorku.ca>,
  12. Naftali Sturm <yu114405@yorku.ca> wrote:
  13.  >I have a big problem.
  14.  >I am making a math and trigonometry program which, one of its functions
  15.  >is to compute the sine of a number.
  16.  > The way I did it was. 
  17.  >    result = sin(numb);
  18.  >
  19.  >result and num are both float's.
  20.  > The problem is that when numb is 1.0, the
  21.  >program gives me .84147 , and when numb is 45.0 
  22.  >the program gives me .85090, and each number is a different result.
  23.  >However I took a look at my sine table in my trigonometry book, and
  24.  >it says the sine of 1 is .018, the sine of 45 is .707, and
  25.  >different results than what my program said.
  26.  >  Why?
  27.  
  28. In case  you don't understand the other two posts, I will clarify.
  29.  
  30. Radians are a measure of angle, just like degrees. Whereas there are 360
  31. degrees in a fullc circle, by definition, radians are defined such that there
  32. are 2*PI radians in a circle. To convert degrees to radians, you divide by 360
  33. and multiply by 2*PI (or simplify that to x 180 / PI ). 
  34.  
  35. The radians measure is ``natural'' for measuring angles because the radius of a
  36. circle fits around the circle 2PI times. An angle of x radians around a radius
  37. of r traces out an arc length of rx. Furthermore, small radian angles can be
  38. approximated by the separation distance, divided by the radius. For example,
  39. if two 100-meter thin rods are connected at one end, and separated by a
  40. distance of 0.1 meters at the other end, you can readily find the approximate
  41. radian angle just by 0.1 / 100 = 0.001 rad, because the separation closely
  42. approximates the arc length. If you were working in degrees, you would have to
  43. divide by pi and multiply by 180, a pain to have to do.
  44.  
  45. Another reason that radians are a ``natural'' measure for degrees is that the
  46. Taylor series expansions of the transcendental functions naturally work
  47. in radians without any odd scale factors in the independent variable.
  48. -- 
  49.  
  50.